package org.nod.atgm.gameobjects;

public abstract class Vehicle extends MovingObject implements StatefulGameObject, IRemovable {

	protected static int BURNT_STAY_DURATION = 10000; //How long destroyed vehicle should stay on scene, ms
	protected int destroyedTime = 0;
	
	protected GameObjectState state = GameObjectState.MOVING;
	protected boolean needsToRemove = false;
	
	@Override
	public void handleTimer(int time) {
		if (state == GameObjectState.MOVING) {
			super.handleTimer(time);
			//TODO move anim 
		} else if (state == GameObjectState.DESTROYED) {
			destroyedTime += time;
			if (destroyedTime >= BURNT_STAY_DURATION)
				needsToRemove = true;
		}
	}

	@Override
	public GameObjectState getState() {
		return state;
	}

	@Override
	public void setState(GameObjectState state) {
		this.state = state;
	}
	
	@Override
	public boolean needsToRemove() {
		return needsToRemove;
	}

	@Override
	public void setNeedsToRemove(boolean needsToRemove) {
		this.needsToRemove = needsToRemove;
	}

}
